<extend name='layout:index'/>
<block name='content'>
<body class="">
    <div class="wrapper wrapper-content">
    
    <div class="row">
    
            <div class="col-sm-12">
            <ul class="nav nav-tabs text-center">
		       <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="a_one" style="width:300px;background-color:white;" onclick="f1()"> 账号升级</a>
		       </li>
		         <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false" id="a_three" style="width:300px;" onclick="f3()">账户降级</a>
               		       </li>
		       <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false" id="a_two" style="width:300px;" onclick="f2()">账号升级记录</a>
		       </li>
		   </ul>
		   
            <div class="table-responsive" style="margin-left:10px;margin-top:10px">
		
				<table class="table table-bordered">
					<tbody><tr>
						<th colspan="3">当前用户信息：
						
						</th>
					</tr>
					<tr>
						<td>用户名：{$user['user_name']}
						</td><td>会员ID：{$user['user_id']}
						</td><td>会员等级：{$user['name']}
					</td></tr>
				</tbody></table>
		 </div>
		 <div class="tab-content">
	       <div id="tab-1" class="tab-pane active">
	          
		           <div class="col-sm-12">
		           
		           <form action="__MODULE__/grand/update" method="post" name="theForm" onSubmit="return checkSubmit(this)">
					           选择升级等级:<span style="color:red">(当前注册积分为{$user['user_money2']})</span>
								  <select name="jg" id="jg" class="form-control" onchange="change1()">
								  <option value="selected111">请选择</option>
								  <if condition='$user.user_type eq 3'>							  										
								  			<option value="5">VIP2</option>								
								  			<option value="10">VIP3</option>								
								  			<option value="30">VIP4</option>								
								  			<option value="50">VIP5</option>								
								  			<option value="100">VIP6</option>
								  <elseif condition='$user.user_type eq 5' />
								  			<option value="10">VIP3</option>								
								  			<option value="30">VIP4</option>								
								  			<option value="50">VIP5</option>								
								  			<option value="100">VIP6</option>
								   <elseif condition='$user.user_type eq 10' />								  						
								  			<option value="30">VIP4</option>								
								  			<option value="50">VIP5</option>								
								  			<option value="100">VIP6</option>	
								  	 <elseif condition='$user.user_type eq 30' /> 						
								  									
								  			<option value="50">VIP5</option>								
								  			<option value="100">VIP6</option>
								  	 <elseif condition='$user.user_type eq 50' />							  						
								  										
								  			<option value="100">VIP6</option>									
								  </if>								
								  </select>
	  						<span style="color:red"><span id="show"></span></span>
            		<div style="margin-top: 10px"><strong>安全密码</strong> </div>
            		<input name="repassword" id="repassword" value="" class="form-control" type="password">
					<input class="btn bg-blue color-white" style="background-color:blue;color:white;margin-left: 45%;margin-top: 10px" onclick="guanbi(this)" value="确定" type="submit">
					</form>	  
					</div>
			
			</div>
				
					 <div id="tab-3" class="tab-pane ">

            		           <div class="col-sm-12">

            		           <form action="__MODULE__/grand/down" method="post" name="theForm" onSubmit="return checkSubmit2(this)">
            					           选择升级等级:<span style="color:red"></span>
            								  <select name="jjg" id="jg" class="form-control" >
            								  		<option value="selected">--选择等级--</option>
            								  		 <if condition='$user.user_type eq 100'>
            								  		 		<option value="3">VIP1</option>				  										
												  			<option value="5">VIP2</option>								
												  			<option value="10">VIP3</option>								
												  			<option value="30">VIP4</option>								
												  			<option value="50">VIP5</option>								
												  	 <elseif  condition='$user.user_type eq 50' />
            								 				<option value="3">VIP1</option>				  										
												  			<option value="5">VIP2</option>								
												  			<option value="10">VIP3</option>								
												  			<option value="30">VIP4</option>
												  	<elseif  condition='$user.user_type eq 30' />
            								 				<option value="3">VIP1</option>				  										
												  			<option value="5">VIP2</option>								
												  			<option value="10">VIP3</option>								
												  	<elseif  condition='$user.user_type eq 10' />
            								 				<option value="3">VIP1</option>				  										
												  			<option value="5">VIP2</option>								
												  	<elseif  condition='$user.user_type eq 5' />
            								 				<option value="3">VIP1</option>				  										
												  			
												  	</if>
            								  </select>
                        		<div style="margin-top: 10px"><strong>安全密码</strong> </div>
                        		<input name="repassword2" id="repassword2" value="" class="form-control" type="password">
            					<button class="btn bg-blue color-white" type="submit" style="background-color:blue;color:white;margin-left: 45%;margin-top: 10px" > 确定</button>
            					</form>
            					</div>

            			</div>

			 <div id="tab-2" class="tab-pane ">
	           
		           <div class="col-sm-12">
					 <div class="tabs-container">
					 <table id="imgList" class="table table-bordered table-striped table-hover">
					<tbody>
						<tr>
							<th width="10%">日期</th>
				            <th width="10%">积分</th>
							<th width="10%">说明</th>
				            <th width="10%">发生会员</th>
						</tr>
						<foreach name='log' item='vo'>
							<tr> 
								<td><?php echo date('Y-m-d H:i:s',$vo['change_time']) ?></td>
		                        <td align="left">
		                        注册积分:{$vo['user_money2']}<p>		                        		                        		                        </p></td>
								<td>会员升级：{$vo['change_desc']}</td>
								<td>{$vo['about_user_name']}</td>
							</tr>
						</foreach>
												</tbody>
				</table>
				<div class="paging">
<form name="selectPageForm" action="/ELT/zx70/rp_user.php" method="get">


 <div id="pager">
  <span style="margin-right:10px;">总计 <b>1</b>  个记录</span>
      
      </div>


</form>
<script type="Text/Javascript" language="JavaScript">

    function change1(){
    	 a = $('#jg').find('option:selected').val();
    	
    	if(!isNaN(a)){
    		$("#show").html('升级改等级还需要注册积分：'+a*100);
    	}else{
    		$("#show").html('选择需要提升的等级');
    	}
    	
    }   
    var k = false;   
   function checkSubmit(){
   		if(!isNaN( $('#jg').find('option:selected').val())){
   			
   		}else{
   			 var txt=  "请先选择升级等级";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
   			return false;
   		}
   		if(a<=3){
   			 var txt=  "升级等级不能小于当前等级";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
   			return false;
   		}
   		if(a>100){
   			 var txt=  "升级该等级尚未开通";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
   			return false;
   		}
   		if($('#repassword').val()==''){
   			 var txt=  "安 全 码 不 能 为 空";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
   			return false;
   		}
   		$.ajax({
   			    type : 'POST',
	            url : '/home/grand/updateAjax',
	            data : {repassword:$('#repassword').val()},
	            dataType : 'html',
	            async : false,
	            success : function(str){
	                if(str==2){
	                   var txt=  "安 全 码 错 误";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
	                    return false;
	                }else{
	                	k = true;
	                }
	             }

   		})
   		return k;
   }
   function checkSubmit2(){
   		if($('#repassword2').val()==''){
   			 var txt=  "安 全 码 不 能 为 空";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
   			return false;
   		}
   		$.ajax({
   			    type : 'POST',
	            url : '/home/grand/downAjax',
	            data : {repassword:$('#repassword2').val()},
	            dataType : 'html',
	            async : false,
	            success : function(str){
	                if(str==2){
	                   var txt=  "安 全 码 错 误";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
	                    return false;
	                }else{
	                	k = true;
	                }
	             }

   		})
   		return k;
   }
    </script>


</div></div></div></div></body>
</block>